		var strId;
		$(function(){
			$('#tableId').editableTableWidget();
			strId = $("#strId").val();
			});
			var length = $("#msg tr").length+1;
			function save(sdId){
				if(confirm("确认要修改吗？")){
					var result="";
					$("#msg tr").each(function(i){
					   
					    $(this).children("td").each(function(i){
					    	if(i>-1){
					    		if($(this).text() == ''){
					    			result += "T_null"+",";
					    		}else{
					    			result+=$(this).text()+",";
					    		}
					    	}
					    });
					   /* $(this).children("th").each(function(i){
					    	if(i >0 ){
								result+=$(this).text()+",";
					    	}
					    }); */
					    result+=";";
					});
					//alert(result);
					var name = document.getElementById("zzmc").value;
					//name = encodeURI(encodeURI(name));
					var code = document.getElementById("zdbh").value;
					if(name == ''){
						alert("请输入字典名称！");
					}else if(code == ''){
						alert("请输入字典编号！");
					}else{
						$.ajax({
							url:"updateSysdictAndSysdictitem.action",
							data:{name:name,
							  code:code,
							  result:result,
							  sdId:sdId,
							  strId:strId},
							  dataType:"JSON",
							  type:"post",
							  success:function(data){
								  if(data.rs){
									  alert("修改成功！");
								  }else{
									  alert("修改失败！");
								  }
								  window.location.href="selectSysDictById.action?pages=1&pageSize=10&type=firs"
							  },
							  error:function(err){
								  alert(err.responseText);
							  }
						})
					}
				}
			}
			function deleteRow(v){
				  v.parentNode.parentNode.removeChild(v.parentNode);
				  length = $("#msg tr").length+1;
				  if(length != null && length != ""){
					  for(var i = 0;i<length;i++){
						  $("#msg tr:eq("+i+") th:eq(0)").text(i+1);
					  }
				  }
			  }

	 	function addRow(){
			$("#msg").append("<tr><th>"+length+"</th><td></td><td></td><td style='display:none'></td><th><button type='button' class=\"btn btn-mini btn-warning\" onclick=\"deleteRow(this.parentNode)\">删除行</button></th></tr>");
			$('#tableId').editableTableWidget();
			length = $("#msg tr").length+1;
			if(length != null && length != ""){
				  for(var i = 0;i<length;i++){
					  $("#msg tr:eq("+i+") th:eq(0)").text(i+1);
				  }
			  }
			
			$('#tableId td').on('change', function(evt, newValue) {
					// do something with the new cell value 
					//alert(evt+":"+newValue);

			})
			
	 	}

	 	/* var length = grid.getData().length;
	 	var row = grid.getRow(lenght-1);
	 	alert(length +":"+row); */